import http from "../index";

// 分页获取首单立减信息
export const getFirstOrders = ({
    ascended = null,
    current = null,
    size = null,
    sortFieldName = null,
    status = null,
    couponName = null,
    sendOut = null,
}) => {
    return http.get("first-order", {
        ascended,
        current,
        size,
        sortFieldName,
        status,
        couponName,
        sendOut,
    });
};

// 根据sid获取首单立减信息
export const getFirstOrderDetail = ({ sid }) => {
    return http.get("first-order/" + sid);
};

// 新增首单立减
export const addFirstOrder = ({
    minAmount,
    preferential,
    status = null,
    note = null,
}) => {
    return http.post("first-order", {
        minAmount,
        preferential,
        status,
        note,
    });
};

// 修改首单立减
export const editFirstOrder = ({
    sid,
    minAmount,
    preferential,
    status = null,
    note = null,
}) => {
    return http.put("first-order/" + sid, {
        minAmount,
        preferential,
        status,
        note,
    });
};

// 批量删除首单立减
export const delFirstOrders = ({ sidList }) => {
    return http.put("first-order/delete", { sidList });
};

// 根据sid发放某首单立减
export const grantFirstOrder = ({ sid }) => {
    return http.put("first-order/" + sid + "/grant");
};

// 根据sid启用-停用首单立减
export const changeFirstOrderStatus = ({ sid }) => {
    return http.put("first-order/" + sid + "/status");
};
